/* Copyright 2017, 2018, Gabriel Czernikier
 *
 * This file is part of Notehaus.
 * Notehaus is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * Notehaus is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with Notehaus.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef __NH_PARSE_FILE_H
#define __NH_PARSE_FILE_H
#include<stdbool.h>
#include<types.h>

// A list of tokens related by position, transversable from latter to earlier, eg. "String" -> "lang" -> "java", and "Entry" -> "Map" -> "util" -> "java"
// This is the representation of the RefTyp_group as it appears in the outline, pseudo code, above.
struct token_list_st {
	lgwseq_t *token;
	struct list_lead token_list;  // For instance, a reference to "java.lang.String" will give rise to "String" as the token, "lang" as the preceeding_token's token, "java" as the next prefix in the chain, which will have NULL as preceeding_token.
};

struct token_list_st *token_list(lgwseq_t *token, struct token_list_st *preceeding);
bool token_list_st_equals(struct token_list_st *a, struct token_list_st *b);
lgwseq_t *strpartcatsep(struct token_list_st *particles, lgwseq_t  *separator);

void
parse_file(const char *fname);
int
yylex(void);
void
yyerror (char const *s);

#endif
